package com.zw.yzk.kabu.data.repository;

import com.zw.yzk.kabu.data.network.task.Task;
import com.zw.yzk.kabu.data.cache.db.DataBaseManager;
import com.zw.yzk.kabu.data.cache.db.User;
import com.zw.yzk.kabu.data.network.entity.UserEntity;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2016/12/24.
 */

public class SplashRepository extends CommonRepository {

    @Inject
    public SplashRepository() {

    }

    @Override
    protected Observable<Boolean> commonObserve(Task task) {
        return Observable.just(DataBaseManager.getInstance().getLoginUser())
                .map(new Func1<User, Boolean>() {
                    @Override
                    public Boolean call(User user) {
                        return user != null && user.getLogin();
                    }
                });
    }

    @Override
    protected Observable connectServer(Task task) {
        return null;
    }

    @Override
    protected Func1<UserEntity, Observable> getServerData() {
        return null;
    }

}
